{include file="header"}
<div style="padding: 20px;" class="adminmyucms">
<form class="layui-form" action="">
<table class="layui-table">
  <thead>
    <tr>
      <th>标题</th>
      <th>模板文件</th>
      <th>别名</th>
      <th>操作</th>
    </tr> 
  </thead>
  <tbody>
    <tr>
      <td><input type="text" name="title" value=""  placeholder="标题" autocomplete="off" lay-verify="required" class="layui-input"></td>
      <td><input type="text" name="name" value="dan_"  placeholder="例如dan_ad.html" autocomplete="off" lay-verify="required" class="layui-input"></td>
      <td><input type="text" name="show" value=""  placeholder="英文字母组成" autocomplete="off" lay-verify="required" class="layui-input"></td>
      <td><button class="layui-btn layui-btn-warm" lay-submit lay-filter="set-add">添加单页</button></td>
    </tr>
  </tbody>
</table>
</form>
 
<table class="layui-table">
 
  <thead>
    <tr>
      <th>标题</th>
      <th>模板文件</th>
      <th>别名</th>
      <th>添加时间</th>
      <th>操作</th>
    </tr> 
  </thead>
  <tbody>
  	{foreach name=":fun_s('danye',array(),'id desc','20,false',0)" item="v" key="k"}
    <tr>
      <td>{$v.title}</td>
      <td>{$v.name}</td>
      <td><a href="*URL*/d_{$v.show}.html" target="_blank">{$v.show}</a></td>
      <td>{$v.time|timeinfo}</td>
      <td id="admin_set">
 
      	<button class="layui-btn layui-btn-sm layui-btn-normal"  data-method="admin_set"  url="{:url("danye/edit")}?id={$v.id}" style="float: left;"><i class="layui-icon">&#xe9aa;</i>编辑</button>
      	<button type="button" class="layui-btn layui-btn-sm layui-btn-danger"  member-name="确定要删除这条单页记录吗" url="{:url("set/delete")}?id={$v.id}&m=danye" lay-submit lay-filter="delete" ><i class="layui-icon">&#xe640;</i> 删除</button>
      </td>
    </tr>
    {/foreach}
  </tbody>
</table>
 
<div class="pages">
{:fun_s('danye',array(),'id desc','20,false',0)->render()}
<div>
<script>
layui.use('form',function(){
  var form = layui.form
  ,jq = layui.jquery;
  //添加
  form.on('submit(set-add)', function(data){
    loading = layer.load(2, {
      shade: [0.2,'#000']
    });
    var param = data.field;
    jq.post('{:url("danye/insert")}',param,function(data){
      if(data.code == 1){
        layer.close(loading);
        layer.msg(data.msg, {icon: 1, time: 1000}, function(){
          location.reload();
        });
      }else{
        layer.close(loading);
        layer.msg(data.msg, {icon: 2, anim: 6, time: 1000});
      }
    });
    return false;
  });
})
</script>
</div>  
{include file="footer"}